﻿using System.Collections.Generic;

namespace TinyAsset.Editor
{
    public class BuildPipeline
    {
        BuildContext context;

        List<IBuildTask> tasks = new List<IBuildTask>();

        public BuildPipeline(BuildContext buildContext)
        {
            context = buildContext;
        }

        public void Append(IBuildTask task)
        {
            tasks.Add(task);
        }

        public void Run()
        {
            for (int i = 0; i < tasks.Count; i++)
            {
                if (!tasks[i].Execute(context))
                    return;
            }
        }
    }
}